import http from "@/api/config";
import { root } from "../config";

/**
 * 根据前缀查询配置
 * @param prefix //
 * @param callback
 */
const getConfigByPrefix = (prefix, callback) => {
  var url = root + "/MarketConfig/getConfigByPrefix";

  let data = new FormData();
  data.append("prefix", prefix);

  http.post(url, data).then(res => {
    callback(res.data);
  });
};

/**
 * 根据前缀查询配置
 * @param prefix //
 * @param callback
 */
const saveConfig = (data, callback) => {
  var url = root + "/MarketConfig/saveConfig";

  http.post(url, data).then(res => {
    callback(res.data);
  });
};

export { getConfigByPrefix, saveConfig };
